package com.spdb.spdbfl.config;

import java.net.URLDecoder;

public class PathDefined {

    /**
     * 获取resources路径
     * @return
     */
    public String getResourcesPath() {
//        String path = System.getProperty("user.dir");
        String path = this.getClass().getClassLoader().getResource("").getPath();
        try {
            path = URLDecoder.decode(path, "UTF-8").replace("/target/test-classes/", "");
            path = path + "/src/test/resources";
            return path;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 获取config路径
     * @return
     */
    public String getConfigPath(){
        String resourcesPath = getResourcesPath();
        String configPath = resourcesPath +"/config.properties";
//        System.out.println("configPath:"+configPath);
        return configPath;
    }


    public static void main(String[] args) {
        PathDefined pathDefined = new PathDefined();
        pathDefined.getConfigPath();
    }

}
